home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / Terminal 2.2 / Terminal Folder / Log into DIGIKRON.s < prev    next >
Text File  |  1990-12-31  |  1KB  |  77 lines

  1. /*
  2.     Terminal 2.0
  3.     Script to dial and log into DIGIKRON using MNP-5
  4.  
  5.     "Log into DIGIKRON.s"
  6. */
  7.  
  8. int TIMEOUT = 3600;    /* 60 seconds */
  9.  
  10. /* ----- Send command and wait for reply ------------------------------- */
  11.  
  12. check(char *command, char *reply, int timeout)
  13. {
  14.     type(command);
  15.     return prompt(reply, timeout);
  16. }
  17.  
  18. /* ----- Wait for prompt and send command ------------------------------ */
  19.  
  20. answer(char *hint, char *command)
  21. {
  22.     int result;
  23.  
  24.     if (result = prompt(hint, TIMEOUT))
  25.         return result;    /* Timeout or cancel */
  26.     pause(30);            /* Don't type immediatly */
  27.     type(command);
  28.     return 0;
  29. }
  30.  
  31. /* ----- main program -------------------------------------------------- */
  32.  
  33. main()
  34. {
  35.     int go = 1;
  36.  
  37.     setup(
  38.         5,        /* 9600 baud */
  39.         1,        /* 8 data */
  40.         0,        /* no parity */
  41.         0,        /* 1 stop */
  42.         -1,        /* port: no change */
  43.         -1,        /* DTR: no change */
  44.         4);        /* Handshake: CTS/DTR (hardware) */
  45.     type("AT\r");
  46.     pause(30);
  47.  
  48.     while (go) {
  49.         /* The "ATZ1" sets my modem into MNP-5 mode */
  50.         if (check("ATZ1\r", "OK", 60))
  51.             break;
  52.         pause(30);
  53.         /* disable data compression */
  54. /*        if (check("AT%%C0\r", "OK", 60))
  55.             break; */
  56.         pause(30);
  57.         if (check("ATDP001,4082531309\r", "CONNECT", TIMEOUT))
  58.             break;
  59.         pause(60);
  60.         type("\r\r");
  61.         if (answer("Your first name?", "Erny\r"))
  62.             break;
  63.         if (answer("Your last name?", "Tontlinger\r"))
  64.             break;
  65.         if (answer("Your password?", "...\r"))
  66.             break;
  67.         go = 0;
  68.     }
  69.     if (go) {
  70.         type("+++");
  71.         pause(120);
  72.         type("ATH\r");
  73.         beep();
  74.     }
  75.     beep();
  76. }
  77.